package com.olinsports.system.olinsportssystem.repository;

import com.olinsports.system.olinsportssystem.model.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

/**
 * Created by Administrator on 2017/7/22.
 */
@Mapper
@CacheConfig(cacheNames = "commodityDetailed")
public interface CommodityDetailedRepository {
    @Cacheable
    public List<CommodityDetailed> selectAll();
    @Cacheable
    public int insertAll(CommodityDetailed commodityDetailed);
    @Cacheable
    public int deleteByKey(int detailedKey);
    @Cacheable
    public int updateData(CommodityDetailed commodityDetailed);
    @Cacheable
    public CommodityDetailed selectByKey(int detailedKey);
    @Cacheable
    public int findCount();
    @Cacheable
    public List<CommodityDetailed> findLimit(@Param("sord") String sord, @Param("sidx") String sidx, @Param("beg") int beg, @Param("end") int end);
    /**
     * 通过查询条件查出总个数
     * @param multiList
     * @return
     */
    @Cacheable
    public int  findByParamsCount(@Param("multiList") List<MultiCondition> multiList);

    /**
     * 通过查询条件进行分页查询
     * @param multiList
     * @param beg
     * @param end
     * @return
     */
    @Cacheable
    public List<CommodityDetailed> findByParamsLimit(@Param("sord") String sord, @Param("sidx") String sidx, @Param("multiList") List<MultiCondition> multiList, @Param("beg") int beg, @Param("end") int end);

    @Cacheable
    public int selectSelfCount(@Param("field") String field,@Param("fieldValue") String fieldValue);

    @Cacheable
    public List<CommodityDetailed> selectSelfLimit(@Param("field") String field, @Param("fieldValue") String fieldValue, @Param("beg") int beg, @Param("end") int end);

    @Cacheable
    public List<CommodityDetailed> selectBySkuType(int skuType);
}
